<template>
	<view class="container">
		<!-- <text v-model="tips">{{tips}}</text> -->
	<!-- 	<text>--------</text>
		<text>{{tips[0].address}}</text> -->
		<view v-for="item in tips" class="item">
			<text class="address">{{item.address}}</text><br>
			
			<text class="detailaddress">{{item.detailaddress}}</text>
			<text class="t-icon t-icon-xingzhuang modify" @click="gotomodifyAddress(item.addressid,item.address,item.detailaddress,item.contractperson,item.contractphone)"></text>
			<view class="personandphone">
				<text class="personandphoneSTR">{{item.contractperson}}</text>
				
				<text class="personandphoneSTR">{{item.contractphone}}</text>
				
			</view>
			<view style="height: 0.5px;margin-left: 18px; background-color: #C0C0C0;"></view>
		</view>
	</view>
	
</template>

<script>
	export default{
		data(){
			return{
				tips:"",
			}
		},
		methods:{
			gotomodifyAddress(aid,abig,adetail,conper,phone){
				uni.navigateTo({
					url:"./modifyAddress?aid="+aid+"&abig="+abig+"&adetail="+adetail+"&conper="+conper+"&phone="+phone+"&flag=modify"
				})
			}
		},
		onNavigationBarButtonTap() {
			uni.navigateTo({
				url:"./addAddress"
			}); 
		},
		onShow() {
			uni.request({
				url:getApp().globalData.http+"/user/getHisAddress",
				method:"GET",
				header:{
					"Authorization":uni.getStorageSync("token")
				},
				success: (res) => {
					this.tips=res.data
				}
			})
		},
		onPullDownRefresh() {
			uni.request({
				url:getApp().globalData.http+"/user/getHisAddress",
				method:"GET",
				header:{
					"Authorization":uni.getStorageSync("token")
				},
				success: (res) => {
					uni.stopPullDownRefresh()
				}
			})
		}
	}
</script>

<style scoped>
	.container{
		overflow: hidden;
		
	}
	.item{
		overflow: hidden;
		width: 100%;
		margin-top: 10px;
	}
	.personandphone{
		
		display: flex;
		flex-direction: row;
		
	}
	.address{
		margin-left: 20px;
		font-size: 17px;
		font-weight: 500;
	
	}
	
	.detailaddress{
		margin-left: 20px;
		font-size: 15px;
	}
	.personandphoneSTR{
		margin-left: 20px;
		margin-bottom: 10px;
		font-size: 15px;
		color: #999999;
	}
	.modify{
		width: 20px;
		height: 20px;
		position: absolute;
		left: 88%;
		background-repeat: no-repeat;
	}
</style>
